/* 遮罩层样式 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 背景遮罩 */
.mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease-out;
  z-index: 9998;
}

/* 对话框基础样式 */
.dialog {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  min-width: 320px;
  max-width: 90vw;
  max-height: 90vh;
  animation: slideIn 0.2s ease-out;
  overflow: hidden;
  position: relative;
  z-index: 10000;
  pointer-events: auto;
}

/* 对话框尺寸变体 */
.dialog.small {
  min-width: 300px;
  max-width: 400px;
}

.dialog.medium {
  min-width: 400px;
  max-width: 600px;
}

.dialog.large {
  min-width: 600px;
  max-width: 800px;
}

/* 对话框头部 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-secondary);
  background: var(--color-bg-secondary);
}

.title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.closeButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: all var(--transition-fast);
  outline: none;
}

.closeButton:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* 对话框内容 */
.content {
  padding: 20px;
}

.content p {
  margin: 0 0 12px 0;
  color: var(--color-text-primary);
  line-height: 1.5;
}

.warningText {
  color: var(--color-warning) !important;
  font-size: 13px;
  margin-bottom: 0 !important;
}

/* 对话框底部 */
.footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border-secondary);
  background: var(--color-bg-secondary);
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}

/* 输入框样式 */
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-md);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition-fast);
  outline: none;
  box-sizing: border-box;
}

.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-alpha);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.input.error {
  border-color: var(--color-error);
}

.input.error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 2px var(--color-error-alpha);
}

/* 输入组样式 */
.inputGroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.errorText {
  font-size: 12px;
  color: var(--color-error);
  margin-top: 2px;
}

/* 按钮样式 */
.button {
  padding: 8px 16px;
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  min-width: 68px;
}

.button.primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.button.primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.button.secondary {
  background: transparent;
  color: var(--color-text-secondary);
}

.button.secondary:hover:not(:disabled) {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.button.danger {
  background: var(--color-error);
  color: white;
  border-color: var(--color-error);
}

.button.danger:hover:not(:disabled) {
  background: var(--color-error-hover);
  border-color: var(--color-error-hover);
}

.button:disabled {
  background: var(--color-bg-disabled);
  color: var(--color-text-disabled);
  border-color: var(--color-border-secondary);
  cursor: not-allowed;
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 移动端对话框适配 */
@media (max-width: 768px) {
  .dialog {
    min-width: 280px;
    max-width: calc(100vw - 32px);
    max-height: 95vh;
  }
  
  .dialog.small,
  .dialog.medium,
  .dialog.large {
    min-width: 280px;
    max-width: calc(100vw - 32px);
  }
  
  .header {
    padding: 14px 16px;
  }
  
  .title {
    font-size: 15px;
  }
  
  .content {
    padding: 16px;
  }
  
  .footer {
    padding: 14px 16px;
  }
  
  .input {
    padding: 12px;
    font-size: 16px; /* 防止iOS缩放 */
  }
}

@media (max-width: 480px) {
  .dialog {
    min-width: 260px;
    max-width: calc(100vw - 16px);
  }
  
  .dialog.small,
  .dialog.medium,
  .dialog.large {
    min-width: 260px;
    max-width: calc(100vw - 16px);
  }
  
  .header {
    padding: 12px 14px;
  }
  
  .content {
    padding: 14px;
  }
  
  .footer {
    padding: 12px 14px;
  }
  
  .button {
    width: 100%;
  }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
  .dialog {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }
}